package com.sebiotec.driver.adapt;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.sebiotec.driver.R;
import com.sebiotec.driver.model.SearchEntrty;


import java.util.List;

public class PendingAdapt extends BaseQuickAdapter<SearchEntrty.RowsBean, BaseViewHolder> {

    public PendingAdapt(int layoutResId, @Nullable List<SearchEntrty.RowsBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, SearchEntrty.RowsBean item) {
        helper.setText(R.id.tv_upcoming_name, item.getName());
        helper.setText(R.id.tv_num, item.getPassengers() + "");


        if ("".equals(item.getServesUser())){

            helper.itemView.findViewById(R.id.ll_dx).setVisibility(View.GONE);
        }
        switch (item.getStatus()) {
            //1:Ambassador pickup 2:Driver pickup 3: Completed(Driver pickdown) 4:Rejected
            case 1:
                helper.setText(R.id.tv_titles,"Confirmed by");
                break;
            case 2:
                helper.setText(R.id.tv_titles, "Picked-up by");
                break;
            case 3:
                helper.setText(R.id.tv_titles, "Picked-up by");
                break;
            case 4:
                helper.setText(R.id.tv_titles, "Droped-off by");
                break;
            case 5:
                helper.setText(R.id.tv_titles, "Completed by");
                break;
            case 6:
                helper.setText(R.id.tv_titles, "Assigned vehicle by");
                break;
            case 7:
                helper.setText(R.id.tv_titles, "Assigned driver by");
                break;
            case 8:
                helper.setText(R.id.tv_titles, "Assigned ambassador by");
                break;
            case -2:
                helper.setText(R.id.tv_titles, "Cancelled by");
                break;
            case -1:
                helper.setText(R.id.tv_titles, "Rejected by");
                break;

            default:
                helper.setText(R.id.tv_titles, "");
                break;
        }
        helper.setText(R.id.tv_address, item.getPickupFrom());
        helper.setText(R.id.tv_pickup_time,item.getPickupDateTime());
        helper.setText(R.id.tv_to_address, item.getDestination());
        helper.setText(R.id.tv_recevied_by,item.getServesUser()+": "+item.getServesDateTime());
        TextView viewById = helper.itemView.findViewById(R.id.tv_upcoming_name);
        TextView viewById1 = helper.itemView.findViewById(R.id.tv_titles);
        TextView viewById2 = helper.itemView.findViewById(R.id.tv_recevied_by);
        viewById.setTextColor(getContext().getColor(R.color.black));
        viewById1.setTextColor(getContext().getColor(R.color.black));
        viewById2.setTextColor(getContext().getColor(R.color.black));


    }
}